﻿using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;

using Ordinaire.Security;
using Ordinaire.Taxonomy.Data;

namespace Ordinaire.Business.Data
{
    [Table]
    public class GoodTag : Tag<int>
    {
        /// <summary>
        /// Returns new instance of Ordianaire.Business.Data with the specified item and vocab ids.
        /// </summary>
        /// <param name="itemId">the item id</param>
        /// <param name="vocabId">the vocab id</param>
        public GoodTag(int itemId, int vocabId, User who) : base(itemId, vocabId, who) { }

        #region Properties

        /// <summary>
        /// Get or set unique id
        /// </summary>
        [Column(IsPrimaryKey = true, IsDbGenerated = true, UpdateCheck = UpdateCheck.Never)]
        public override int Id
        {
            get { return base.Id; }
            set { base.Id = value; }
        }

        /// <summary>
        /// Get or set item id or id of related table.
        /// </summary>
        [Column(Name = "SaleItemId", CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
        public override int ItemId
        {
            get { return base.itemId; }
            set { base.itemId = value; }
        }

        /// <summary>
        /// Get or set vocab id
        /// </summary>
        [Column(CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
        public override int VocabId
        {
            get { return base.vocabId; }
            set { base.vocabId = value; }
        }

        /// <summary>
        /// Get or set creator
        /// </summary>
        [Column(UpdateCheck = UpdateCheck.Never)]
        public override string CreatedBy
        {
            get { return base.CreatedBy; }
            set { base.CreatedBy = value.TrimOrEmpty(); }
        }

        /// <summary>
        /// Get or set creation date
        /// </summary>
        [Column(UpdateCheck = UpdateCheck.Never)]
        public override DateTime? CreatedOn
        {
            get { return base.CreatedOn; }
            set { base.CreatedOn = value; }
        }

        /// <summary>
        /// Get or set updator
        /// </summary>
        [Column(UpdateCheck = UpdateCheck.Never)]
        public override string UpdatedBy
        {
            get { return base.UpdatedBy; }
            set { base.UpdatedBy = value.TrimOrEmpty(); }
        }

        /// <summary>
        /// Get or set update date
        /// </summary>
        [Column(UpdateCheck = UpdateCheck.Never)]
        public override Nullable<DateTime> UpdatedOn
        {
            get { return base.UpdatedOn; }
            set { base.UpdatedOn = value; }
        }

        #endregion
    }
}
